package server;

import Constans.Constants;
import bean.RpcResult;
import com.alibaba.fastjson.JSONObject;
import request.RpcReq;

/**
 * @author:zhengyilong
 * @email:1797344574@qq.com
 * @phone:13479394730
 * @desc:该类用于实现通过rpc访问调用bitcoin core的getbestblockhash功能
 * @DateTime:2021/12/13 17:08
 **/
public class GetBestBlockHash {

    //获取当前节点最高位的区块哈希值
    public static RpcResult getBestBlockHash(int id){
        //调用rpc请求公共部分
        String result = RpcReq.rpcReq(id, Constants.GETBESTBLOCKHASH);

        //对响应结果进行反序列化并返回
        return JSONObject.parseObject(result, RpcResult.class);
    }

}

